home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / Joe Zobkiw (FYI) / Updated Fragment Information < prev   
Encoding:
Text File  |  1997-04-30  |  2.3 KB  |  79 lines  |  [ttro/ttxt]

  1. Introduction
  2.  
  3. This file contains updated information for the Addison-Wesley Macintosh programming title "A Fragment of Your Imagination" written by Joe Zobkiw. For updated information visit the web site at http://www.triplesoft.com/fragment/
  4.  
  5. Corrupt Data
  6.  
  7. The copy of the source code on the CW7 CD from Metrowerks contains some corrupt files. You can obtain a non-corrupt version from the Metrowerks WWW site at <http://www.metrowerks.com>
  8.  
  9. Control Panel Native Code
  10.  
  11. The source code for the control panel chapter contains a compiled control panel. The only caveat is that the control panel is compiled for PowerPC. Therefore, if you double-click the control panel on a 680x0 Macintosh, it will crash with an unimplemented instruction. Simply build the 680x0 cdev project before running the control panel on your 680x0 Macintosh.
  12.  
  13. New Macros (CodeWarrior 7)
  14.  
  15. CodeWarrior 7 includes new macros to help make your code resource source code more transparent when writing for both 680x0 and PowerPC processors. 
  16.  
  17. The file A4Stuff.h contains:
  18.  
  19. #ifndef powerc
  20.  
  21.     #define EnterCodeResource() long oldA4 = SetCurrentA4()
  22.     #define ExitCodeResource() SetA4(oldA4)
  23.     long SetCurrentA4(void);
  24.     long SetA4(long:__D0):__D0 = 0xC18C;
  25.     long GetCurrentA4(void) = 0x200C;
  26.     pascal void UnloadA4Seg(void *);
  27.  
  28. #else
  29.  
  30.     #define EnterCodeResource()
  31.     #define ExitCodeResource()
  32.     #define SetCurrentA4()     0L
  33.     #define SetA4(x)        0L
  34.     #define GetCurrentA4()     0L
  35.     #define UnloadA4Seg(x)     0
  36.  
  37. #endif
  38.  
  39. The file SetUpA4.h contains:
  40.  
  41. #ifndef powerc
  42.  
  43.     #define PrepareCallback() RememberA4() 
  44.     #define EnterCallback() long oldA4 = SetUpA4()
  45.     #define ExitCallback() RestoreA4(oldA4)
  46.  
  47.     static void RememberA4(void);
  48.     
  49.     static asm long SetUpA4(void)
  50.     {
  51.         move.l    a4,d0
  52.         lea        storage,a4
  53.         move.l    (a4),a4
  54.         rts
  55.     
  56.     storage:    dc.l    0    /* this storage is only referenced thru data cache */
  57.     
  58.         entry    static RememberA4
  59.         lea        storage,a0
  60.         move.l    a4,(a0)
  61.         rts
  62.     }
  63.     
  64.     static long RestoreA4(long:__D0):__D0 = 0xC18C;
  65.  
  66. #else
  67.  
  68.     #define PrepareCallback() 
  69.     #define EnterCallback()
  70.     #define ExitCallback()
  71.     #define RememberA4()     0
  72.     #define SetUpA4()         0L
  73.     #define RestoreA4(x)    0L
  74.     
  75. #endif
  76.  
  77. You should read the comments in each file for complete information on how to use these new macros. They will make your coding life much easier and make your code easier to read.
  78.  
  79.